// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   TogetherPhoto.java

package com.kaylyn.item;

import com.kaylyn.util.Initializable;
import com.kaylyn.util.Resource;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import javax.swing.*;

public class TogetherPhoto extends JLabel implements Initializable {

	public TogetherPhoto() {
		setSize(840, 560);
		setIcon(new ImageIcon(Resource.loadImage("206346.jpg")));
		setOpaque(true);
		showLabel = new JLabel();
		showLabel.setSize(420, 560);
		showLabel.setLocation(420, 0);
		showLabel.setBorder(BorderFactory.createRaisedBevelBorder());
		showLabel.setVisible(false);
		showLabel.addMouseListener(new MouseAdapter() {

			public void mouseReleased(MouseEvent e) {
				showLabel.setVisible(false);
			}

			// final TogetherPhoto this$0;
			//
			//            
			// {
			// this$0 = TogetherPhoto.this;
			// super();
			// }
		});
		imgIcon = new ImageIcon[img.length];
		for (int i = 0; i < img.length; i++)
			imgIcon[i] = new ImageIcon(Resource.loadImage(img[i]));

		viewIcon = new ImageIcon[view.length];
		viewLabel = new JLabel[view.length];
		for (int i = 0; i < view.length; i++) {
			viewIcon[i] = new ImageIcon(Resource.loadImage(view[i]));
			viewLabel[i] = new JLabel();
			viewLabel[i].setSize(75, 100);
			final int j = i;
			viewLabel[i].addMouseListener(new MouseAdapter() {

				public void mouseEntered(MouseEvent e) {
					viewLabel[j].setBorder(BorderFactory.createLineBorder(
							Color.WHITE, 3));
				}

				public void mouseExited(MouseEvent e) {
					viewLabel[j].setBorder(BorderFactory.createEmptyBorder());
				}

				public void mouseReleased(MouseEvent e) {
					showLabel.setVisible(true);
					Runnable r = new Runnable() {

						public void run() {
							long framerate = 9L;
							BufferedImage icon = new BufferedImage(420, 560, 2);
							for (float alpha = 0.0F; alpha < 1.0F;) {
								long frameStart = System.currentTimeMillis();
								int rule = 11;
								Graphics2D g2 = (Graphics2D) icon.getGraphics();
								g2.setComposite(AlphaComposite.getInstance(
										rule, alpha));
								g2.drawImage(imgIcon[j].getImage(), 0, 0, null);
								showLabel.setIcon(new ImageIcon(icon));
								repaint();
								alpha = (float) ((double) alpha + 0.10000000000000001D);
								try {
									long elapsedTime = System
											.currentTimeMillis()
											- frameStart;
									if (elapsedTime < framerate)
										Thread.sleep(framerate - elapsedTime);
									else
										Thread.sleep(30L);
								} catch (InterruptedException e1) {
									e1.printStackTrace();
								}
							}

							showLabel.setIcon(imgIcon[j]);
						}

					};
					(new Thread(r)).start();
				}

			});
			EventQueue.invokeLater(new Runnable() {

				public void run() {
					viewLabel[j].setIcon(viewIcon[j]);
					add(viewLabel[j]);
				}

			});
		}

		viewLabel[0].setLocation(70, 210);
		viewLabel[1].setLocation(170, 210);
		viewLabel[2].setLocation(270, 210);
		viewLabel[3].setLocation(70, 330);
		viewLabel[4].setLocation(170, 330);
		viewLabel[5].setLocation(270, 330);
		viewLabel[6].setLocation(70, 450);
		viewLabel[7].setLocation(170, 450);
		viewLabel[8].setLocation(270, 450);

		add(showLabel);
		
	}

	public void start() {

	}

	public void stop() {
	}

	private static final long serialVersionUID = 1L;
	private JLabel showLabel;
	private String img[] = { "DSC03362.jpg", "DSC03397.jpg", "DSC03425.jpg",
			"IMG_025.jpg", "IMG_032.jpg", "IMG_034.jpg", "IMG_2129.jpg",
			"IMG_2671.jpg", "IMG_2726.jpg" };
	private String view[] = { "0DSC03362.jpg", "0DSC03397.jpg",
			"0DSC03425.jpg", "0IMG_025.jpg", "0IMG_032.jpg", "0IMG_034.jpg",
			"0IMG_2129.jpg", "0IMG_2671.jpg", "0IMG_2726.jpg" };
	private ImageIcon imgIcon[];
	private ImageIcon viewIcon[];
	private JLabel viewLabel[];

}
